﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;

namespace Scheduling.Models.Helpers
{
    public class Configuration
    {
        /// <summary>
        /// Setting for the Password Salt using when hashing passwords. 
        /// </summary>
        public static string PasswordSalt
        {
            get { return ConfigurationManager.AppSettings["PasswordSalt"]; }
        }

        /// <summary>
        /// The path to the database file if used. 
        /// </summary>
        public static string DatabasePath
        {
            get { return ConfigurationManager.AppSettings["DatabasePath"]; }
        }

        /// <summary>
        /// The ConnectionString to a real database if used. 
        /// </summary>
        public static string ConnectionString
        {
            get 
            {
                string s = ConfigurationManager.AppSettings["ConnectionString"];
                if (s.Contains("@DATABASEPATH"))
                    return ConfigurationManager.AppSettings["ConnectionString"].Replace("@DATABASEPATH@", HttpContext.Current.Server.MapPath(DatabasePath));
                else
                    return s;
            }
        }
    }
}